<div class="bg-light lter b-b wrapper-md">
    <h4 class="m-n font-thin">角色管理</h4>
</div>
<div class="wrapper-md ng-scope">
    <div class="panel panel-default" ng-controller="roleCtrl">
        <div class="row wrapper">
            <div class="col-sm-9">
                <form class="form-inline">
                    <div class="form-group">
                        <label class="control-label">角色名称</label>
                        <input type="text" ng-model="role.name" class="input-sm form-control">
                    </div>
                    <button ng-click="query()" class="btn btn-sm btn-default">查询</button>
                </form>
            </div>
            <div class="col-sm-3">
                <div class=" pull-right">
                    <a ui-sref="app.roleCreate" class="btn btn-sm btn-info" target="_blank">添加角色</a>
                </div>
            </div>
            <div class="clearfix"></div>
        </div>
        <div class="table-responsive">
            <table class="table table-striped b-t b-light">
                <thead>
                    <tr>
                        <th>编号</th>
                        <th>角色名称</th>
                        <th>描述</th>
                        <th>创建时间</th>
                        <th width="200" class="text-center">操作</th>
                    </tr>
                </thead>
                <tbody>
                    <tr ng-repeat="r in list">
                        <td>{{r.code}}</td>
                        <td>{{r.name}}</td>
                        <td>{{r.description}}</td>
                        <td>{{r.createdTime}}</td>
                        <td class="t-btns text-right" ng-if="r.isCommon==0">
                            <button ui-sref="app.authorize({id:r.id})" class="btn btn-sm btn-success">权限设置</button>
                            <button ui-sref="app.roleEdit({id:r.id})" class="btn btn-sm btn-info">修改</button>
                            <button class="btn btn-sm btn-danger" ng-click="deleteRole(r.id,r.name)">删除</button>
                        </td>
                        <td class="t-btns text-center" ng-if="r.isCommon==1">
                            <span class="h6 text-muted">公共角色无法操作</span>
                        </td>
                    </tr>
                </tbody>
            </table>
            <div ng-if="list.length<=0 && !app.loading" class="padder-v text-center">
                <span class="h6">~未搜索到任何数据~</span>
            </div>
            <div>
                <circle-loading ng-if="app.loading"></circle-loading>
            </div>
        </div>
        <footer class="panel-footer">
            <div class="row">
                <div class="col-sm-4 hidden-xs">
                    <!--<button class="btn btn-sm btn-default">批量冻结</button>
                    <button class="btn btn-sm btn-default">批量删除</button>-->
                </div>
                <div class="col-sm-4 text-center">
                    <small class="text-muted inline m-t-sm m-b-sm">显示第 {{startRow}} 至 {{endRow}} 项结果，共 {{totalItems}} 项</small>
                </div>
                <div class="col-sm-4 text-right text-center-xs">
                    <pagination boundary-links="true" total-items="totalItems" ng-model="currentPage"
                                ng-change="pageChanged()" max-size="{{maxPageRow}}" class="pagination-sm m-t-none m-b"
                                previous-text="上一页" next-text="下一页"
                                first-text="首页" last-text="尾页"></pagination>
                </div>
            </div>
        </footer>
    </div>
</div>
